<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

/*
| GET|HEAD  | Admin              | Admin.index   | App\Http\Controllers\IndexController@index   展示页面
| POST      | Admin              | Admin.store   | App\Http\Controllers\IndexController@store    添加操作
| GET|HEAD  | Admin/create       | Admin.create  | App\Http\Controllers\IndexController@create   添加页面
| DELETE    | Admin/{Admin}      | Admin.destroy | App\Http\Controllers\IndexController@destroy  删除操作
| PUT|PATCH | Admin/{Admin}      | Admin.update  | App\Http\Controllers\IndexController@update   更新操作
| GET|HEAD  | Admin/{Admin}      | Admin.show    | App\Http\Controllers\IndexController@show
| GET|HEAD  | Admin/{Admin}/edit | Admin.edit    | App\Http\Controllers\IndexController@edit   修改页面
*/

//Route::get('/', function () {
//    return view('welcome');
//});
Route::get("wxpay","IndexController@index");//微信支付
Route::get("wxpayNotify","NotifyController@index");
//微信 SDK for Laravel, 基于 overtrue/wechat
Route::any('/wechat', 'WeChatController@serve');


//前台路由
    //主页
    Route::get("/","Home\IndexController@index");

    //分类页面
    Route::get('/types/{id}','Home\TypesController@index');

    //商品详情页面
    Route::get('/goods/{id}','Home\GoodsController@index');

    //登录页面
    Route::get('/login','Home\LoginController@index');

    //注册页面
    Route::get('/reg','Home\RegController@index');

    //处理注册操作
    Route::post('/regCheck',"Home\RegController@check");

    //短信注册处理页面
    Route::any('register','Home\RegisterController@index');

    //验证码
    Route::get('code','Home\RegisterController@code');

    //验证短信验证码
    Route::any('smsyzm','Home\RegisterController@smsyzm');



    //发送邮件
   // Route::get('/fasong','Home\RegController@fasong');

    //激活地址
    Route::get('jihuo/{id}/{token}','Home\RegController@jihuo');

    //处理登录
    Route::post('/check',"Home\LoginController@check");

    //退出登录
    Route::get('/logout','Home\LoginController@logout');

    //找回密码
    Route::any('/zhaohui','Home\LoginController@zhaohui');

    //修改密码
    Route::any("/savePass/{id}/{token}","Home\LoginController@savePass");

    //购物车
    Route::get("/car","Home\CarController@index");
    //加入购物车
    Route::get("addCar","Home\CarController@addCar");

    //购物车ajax调整数量
    Route::post('CarAdd','Home\CarController@CarAdd');
    Route::post('CarJian','Home\CarController@CarJian');
    Route::post('CarDel','Home\CarController@CarDel');

    //结算页面
    Route::any("jiesuan","Home\CarController@jiesuan");

    //生成订单
    route::post("orders","Home\OrdersController@index");

    //支付路由
    Route::get("pay/{code}","Home\OrdersController@pay");

//后台路由

    //登录页面
    Route::get('admin/login','Admin\LoginController@index');

    //验证码
    Route::get('admin/yzm','Admin\LoginController@yzm');
    //登录处理操作
    Route::post('admin/check','Admin\LoginController@check');
    //后台退出
    Route::get('admin/logout','Admin\LoginController@logout');


    //清除缓存
    Route::get('admin/flush','Admin\IndexController@flush');


    Route::group(['namespace'=>'Admin','prefix'=>'admin','middleware'=>'adminLogin'],function(){

        //后台首页路由
            Route::get('','IndexController@index');

        //后台管理员管理
            Route::resource('admin','AdminController');
        //后台管理员状态修改路由
            Route::post('admin/ajaxStatu','AdminController@ajaxStatu');

        //后台用户管理
            Route::get('user','UserController@index');

        // 后台的商品管理
            Route::resource('goods','GoodsController');

        //后台订单管理
        Route::get('orders','OrdersController@index');
            //查看订单详情
            Route::get("orders/list","OrdersController@lists");
            //查看收货地址
            Route::get("orders/addr","OrdersController@addr");
            //修改订单状态
            Route::any("orders/edit","OrdersController@edit");

            //订单状态
            Route::get("orders/statu","OrdersController@statuList");
            Route::post("orders/statu/edit","OrdersController@statuEdit");

            //评论管理
            Route::get("comment","CommentController@index");
            Route::post("comment/ajaxStatu","CommentController@ajaxStatu");

        //后台分类管理
            Route::resource('types','TypesController');

        //后台系统管理
            //系统管理
            Route::resource("sys/config","ConfigsController");
            //轮播图管理
            Route::resource("sys/slider","SliderController");
            //广告管理
            Route::resource("sys/ads","AdsController");
            //分类广告管理
            Route::resource("sys/types","TypesAdsController");
            //文件上传路由
            Route::any('shangchuan','CommonController@upload');

            //缓存
            Route::get("huancun","HuancunController@index");

    });
